package com.ruoyi.locker.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.locker.domain.Locker;
import com.ruoyi.locker.domain.vo.LockerVo;
import com.ruoyi.locker.mapper.LockerMapper;
import com.ruoyi.locker.service.ILockerService;
import com.ruoyi.season.domain.vo.PrizeInfoVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 寄存柜Service业务层处理
 *
 * @author ruoyi
 * @date 2024-01-14
 */
@Service
public class LockerServiceImpl extends ServiceImpl<LockerMapper,Locker> implements ILockerService
{
    @Resource
    private LockerMapper lockerMapper;

    /**
     * 查询寄存柜
     *
     * @param id 寄存柜主键
     * @return 寄存柜
     */
    @Override
    public Locker selectLockerById(String id)
    {
        return lockerMapper.selectLockerById(id);
    }

    /**
     * 查询寄存柜列表
     *
     * @param locker 寄存柜
     * @return 寄存柜
     */
    @Override
    public List<Locker> selectLockerList(Locker locker)
    {
        return lockerMapper.selectLockerList(locker);
    }

    /**
     * 新增寄存柜
     *
     * @param locker 寄存柜
     * @return 结果
     */
    @Override
    public int insertLocker(Locker locker)
    {
        locker.setCreateTime(DateUtils.getNowDate());
        return lockerMapper.insertLocker(locker);
    }

    /**
     * 修改寄存柜
     *
     * @param locker 寄存柜
     * @return 结果
     */
    @Override
    public int updateLocker(Locker locker)
    {
        return lockerMapper.updateLocker(locker);
    }

    /**
     * 批量删除寄存柜
     *
     * @param ids 需要删除的寄存柜主键
     * @return 结果
     */
    @Override
    public int deleteLockerByIds(String[] ids)
    {
        return lockerMapper.deleteLockerByIds(ids);
    }

    /**
     * 删除寄存柜信息
     *
     * @param id 寄存柜主键
     * @return 结果
     */
    @Override
    public int deleteLockerById(String id)
    {
        return lockerMapper.deleteLockerById(id);
    }

    @Override
    public IPage<LockerVo> lockerInfo(IPage<LockerVo> page, Integer type, Integer productType, String loginUserId) {
        List<LockerVo> result = baseMapper.lockerInfo(page,type,productType,loginUserId);

        return page.setRecords(result);
    }
}
